(function() {
	const response = {
		type: 'page',
		name: "rmUpdateAssetOutbound",
		title: '出库资产审批',
		body:[
			{
				type: "crud",
				name: "AssetOutbound",
				syncLocation: false,
				api: {
					method: "post",
					url: "/repoManger/rmGetAssetOutbounds",
				},
				"autoFillHeight": true,
				loadDataOnce: true,
				columns:[
					{
						name: "id",
						label: "出库申请ID",
						// hidden: true
					},
					{
						name: "assetId",
						label: "资产ID"
					},
					{
						name: "assetManagerId",
						label: "资产管理员ID"
					},
					{
						name: "assetSecondmentId",
						label: "借调申请ID"
					},
					{
						name: "repositoryId",
						label: "资产所在仓库ID"
					},
					{
						name: "result",
						label: "申请进度"
					},
					{
						name: "createTime",
						type: "date",
						fromNow: "true",
						label: "申请时间"
					},
					{
						name: "isComplete",
						label: "申请状态"
					},
					{
						"type": "operation",
						"label": "操作",
						"width": 100,
						"buttons": [
							{
								"type": "button",
								"label": "同意申请",
								"actionType": "ajax",
								"reload": "AssetOutbound", //请求完成后刷新assetImports组件
								"api": {
									"method": "post",
									"url": "/repoManger/rmUpdateAssetOutbound",
									"data":{
										"approvalId": "${id}",
										"result": "true"
									},
									// //当只剩最后一个记录的时候，再次发送审批请求后返回的status状态码为400，所以选择直接刷新
									// adaptor: function (payload, response) {
									// 	(function (){
									// 		if(payload.status===0){
									// 			payload.msg="已同意申请";
									// 		}
									// 	})();
									// 	(function (){
									// 		if(payload.status===400){
									// 			payload.msg="申请审批完成!"
									// 			payload.status=0;
									// 			window.location.reload();
									// 		}
									// 	})();
									// 	return payload;
									// }
								},
								"id": "u:313ed32d4918"
							},
							{
								"type": "button",
								"label": "拒绝申请",
								"actionType": "ajax",
								"reload": "AssetOutbound",
								"api": {
									"method": "post",
									"url": "/repoManger/rmUpdateAssetOutbound",
									"data":{
										"approvalId": "${id}",
										"result": "false"
									},
									//当只剩最后一个记录的时候，再次发送审批请求后返回的status状态码为400，所以选择直接刷新
									adaptor: function (payload, response) {
										(function (){
											if(payload.msg==="获取用户申请"){
												payload.msg="已拒绝申请";
											}
										})();
										(function (){
											if(payload.msg==="无可出库申请"||payload.status===400){
												payload.msg="所以申请已审批完成";
												payload.status=0;
												window.location.reload();
											}
										})();
										return payload;
									}
								},
								"id": "u:b4389f67f70c"
							}
						]
					}
				]


			}
		]

	}


	window.jsonpCallback && window.jsonpCallback(response);
})();
